package com.ocp.macro.utils;

import com.baomidou.mybatisplus.annotation.TableField;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Arrays;
import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class PageObject {
    // 默认当前页
    private final static Integer DEFAULT_PAGE = 1;
    // 默认每页数据条数
    private final static Integer DEFAULT_ROWS = 10;

    public Integer page; // 当前页
    public Integer rows; // 每页数据条数
    public Long total;

    public List<Object> list;// 存数据的id，用于批量操作

    public int getPage(){
        if(page==null||page==0)
            this.page = DEFAULT_PAGE;
        return page;
    }

    public int getRows(){
        if(rows==null||rows==0)
            this.rows = DEFAULT_ROWS;
        return rows;
    }
}

